package com.electric.action;

import com.electric.base.BaseAction;
import com.electric.model.User;
import com.electric.service.UserService;

public class RegistAction extends BaseAction{
	private static final long serialVersionUID = 1L;
	public String username ;
	public String pass ;
	public String email ;
	
	private UserService userService = new UserService(); 

	public String execute() throws Exception {
		User u = new User();
		u.setUsername(username);
		u.setEmail(email);
		u.setPassword(pass);
		userService.add(u);
		userService.update(u);
		
		//this.setUsername(userService.list().get(0).getUsername());
		
		return SUCCESS;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	
	public String getPassword() {
		return pass;
	}

	public void setPass(String pass) {
		this.pass = pass;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
}
